home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2000 February / Macworld (2000-02).dmg / Updaters / WhiteCap 3.2.2.sea / WhiteCap 3.2.2 / WhiteCap Source / DirectX3 SDK / inc / dplobby.h < prev    next >
Text File  |  1996-09-05  |  13KB  |  382 lines

  1. /*==========================================================================;
  2.  *
  3.  *  Copyright (C) 1996 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *  File:       dplobby.h
  6.  *  Content:    DirectPlayLobby include file
  7.  ***************************************************************************/
  8. #ifndef __DPLOBBY_INCLUDED__
  9. #define __DPLOBBY_INCLUDED__
  10.  
  11. #include "dplay.h"
  12.  
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif /* __cplusplus */
  16.  
  17. /*
  18.  * GUIDS used by DirectPlay objects
  19.  */
  20.  
  21. /* {AF465C71-9588-11cf-A020-00AA006157AC} */
  22. DEFINE_GUID(IID_IDirectPlayLobby, 0xaf465c71, 0x9588, 0x11cf, 0xa0, 0x20, 0x0, 0xaa, 0x0, 0x61, 0x57, 0xac);
  23. /* {26C66A70-B367-11cf-A024-00AA006157AC} */
  24. DEFINE_GUID(IID_IDirectPlayLobbyA, 0x26c66a70, 0xb367, 0x11cf, 0xa0, 0x24, 0x0, 0xaa, 0x0, 0x61, 0x57, 0xac);
  25.  
  26.  
  27.  
  28. /****************************************************************************
  29.  *
  30.  * IDirectPlayLobby Structures
  31.  *
  32.  * Various structures used to invoke DirectPlayLobby.
  33.  *
  34.  ****************************************************************************/
  35.  
  36. typedef struct IDirectPlayLobby     FAR *LPDIRECTPLAYLOBBY;
  37. typedef struct IDirectPlayLobby     FAR *LPDIRECTPLAYLOBBYA;
  38. typedef struct IDirectPlayLobby     IDirectPlayLobbyA;
  39.  
  40.  
  41. /*
  42.  * DPLCONNECTION
  43.  * Used to hold all in the informaion needed to connect
  44.  * an application to a session or create a session
  45.  */
  46. typedef struct DPLCONNECTION
  47. {
  48.     DWORD               dwSize;             // Size of this structure
  49.     DWORD               dwFlags;            // Flags specific to this structure
  50.     LPDPSESSIONDESC2    lpSessionDesc;      // Pointer to session desc to use on connect
  51.     LPDPNAME            lpPlayerName;       // Pointer to Player name structure
  52.     GUID                guidSP;             // GUID of the DPlay SP to use
  53.     LPVOID              lpAddress;          // Address for service provider
  54.     DWORD               dwAddressSize;      // Size of address data
  55. } DPLCONNECTION, FAR *LPDPLCONNECTION;
  56.  
  57. /*
  58.  * LPCDPLCONNECTION
  59.  * A constant pointer to DPLCONNECTION
  60.  */
  61. typedef const DPLCONNECTION FAR *LPCDPLCONNECTION;
  62.  
  63. /*
  64.  * This application should create a new session as
  65.  * described by the DPSESIONDESC structure
  66.  */
  67. #define DPLCONNECTION_CREATESESSION         DPOPEN_CREATE
  68.  
  69. /*
  70.  * This application should join the session described by 
  71.  * the DPSESIONDESC structure with the lpAddress data
  72.  */
  73. #define DPLCONNECTION_JOINSESSION           DPOPEN_JOIN
  74.  
  75.  
  76. /*
  77.  * DPLAPPINFO
  78.  * Used to hold information about a registered DirectPlay
  79.  * application
  80.  */
  81. typedef struct DPLAPPINFO
  82. {
  83.     DWORD       dwSize;             // Size of this structure
  84.     GUID        guidApplication;    // GUID of the Application
  85.     union
  86.     {
  87.         LPSTR   lpszAppNameA;       // Pointer to the Application Name
  88.         LPWSTR  lpszAppName;
  89.     };
  90.  
  91. } DPLAPPINFO, FAR *LPDPLAPPINFO;
  92.  
  93. /*
  94.  * LPCDPLAPPINFO
  95.  * A constant pointer to DPLAPPINFO
  96.  */
  97. typedef const DPLAPPINFO FAR *LPCDPLAPPINFO;
  98.  
  99. /****************************************************************************
  100.  *
  101.  * Enumeration Method Callback Prototypes
  102.  *
  103.  ****************************************************************************/
  104.  
  105. /*
  106.  * Callback for EnumAddress()
  107.  */
  108. typedef BOOL (FAR PASCAL *LPDPENUMADDRESSCALLBACK)(
  109.     REFGUID         guidDataType,
  110.     DWORD           dwDataSize,
  111.     LPCVOID         lpData,
  112.     LPVOID          lpContext);
  113.  
  114. /*
  115.  * Callback for EnumAddressTypes()
  116.  */
  117. typedef BOOL (FAR PASCAL *LPDPLENUMADDRESSTYPESCALLBACK)(
  118.     REFGUID         guidDataType,
  119.     LPVOID          lpContext,
  120.     DWORD           dwFlags);
  121.  
  122. /*
  123.  * Callback for EnumLocalApplications()
  124.  */
  125. typedef BOOL (FAR PASCAL * LPDPLENUMLOCALAPPLICATIONSCALLBACK)(
  126.     LPCDPLAPPINFO   lpAppInfo,
  127.     LPVOID          lpContext,
  128.     DWORD           dwFlags);
  129.  
  130.  
  131. /****************************************************************************
  132.  *
  133.  * DirectPlayLobby API Prototypes
  134.  *
  135.  ****************************************************************************/
  136. #ifdef UNICODE
  137. #define DirectPlayLobbyCreate   DirectPlayLobbyCreateW
  138. #else
  139. #define DirectPlayLobbyCreate   DirectPlayLobbyCreateA
  140. #endif /* UNICODE */
  141.  
  142. extern HRESULT WINAPI DirectPlayLobbyCreateW(LPGUID, LPDIRECTPLAYLOBBY *, IUnknown *, LPVOID, DWORD );
  143. extern HRESULT WINAPI DirectPlayLobbyCreateA(LPGUID, LPDIRECTPLAYLOBBYA *, IUnknown *, LPVOID, DWORD );
  144.  
  145.  
  146. /****************************************************************************
  147.  *
  148.  * IDirectPlayLobby (and IDirectPlayLobbyA) Interface
  149.  *
  150.  ****************************************************************************/
  151. #undef INTERFACE
  152. #define INTERFACE IDirectPlayLobby
  153. DECLARE_INTERFACE_( IDirectPlayLobby, IUnknown )
  154. {
  155.     /*  IUnknown Methods        */
  156.     STDMETHOD(QueryInterface)       (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  157.     STDMETHOD_(ULONG,AddRef)        (THIS) PURE;
  158.     STDMETHOD_(ULONG,Release)       (THIS) PURE;
  159.  
  160.     /*  IDirectPlayLobby Methods        */
  161.     STDMETHOD(Connect)              (THIS_ DWORD, LPDIRECTPLAY2 *, IUnknown FAR *) PURE;
  162.     STDMETHOD(CreateAddress)        (THIS_ REFGUID, REFGUID, LPCVOID, DWORD, LPVOID, LPDWORD) PURE;
  163.     STDMETHOD(EnumAddress)          (THIS_ LPDPENUMADDRESSCALLBACK, LPCVOID, DWORD, LPVOID) PURE;
  164.     STDMETHOD(EnumAddressTypes)     (THIS_ LPDPLENUMADDRESSTYPESCALLBACK, REFGUID, LPVOID, DWORD) PURE;
  165.     STDMETHOD(EnumLocalApplications)(THIS_ LPDPLENUMLOCALAPPLICATIONSCALLBACK, LPVOID, DWORD) PURE;
  166.     STDMETHOD(GetConnectionSettings)(THIS_ DWORD, LPVOID, LPDWORD) PURE;
  167.     STDMETHOD(ReceiveLobbyMessage)  (THIS_ DWORD, DWORD, LPDWORD, LPVOID, LPDWORD) PURE;
  168.     STDMETHOD(RunApplication)       (THIS_ DWORD, LPDWORD, LPDPLCONNECTION, HANDLE) PURE;
  169.     STDMETHOD(SendLobbyMessage)     (THIS_ DWORD, DWORD, LPVOID, DWORD) PURE;
  170.     STDMETHOD(SetConnectionSettings)(THIS_ DWORD, DWORD, LPDPLCONNECTION) PURE;
  171.     STDMETHOD(SetLobbyMessageEvent) (THIS_ DWORD, DWORD, HANDLE) PURE;
  172.  
  173. };
  174.  
  175. /****************************************************************************
  176.  *
  177.  * IDirectPlayLobby interface macros
  178.  *
  179.  ****************************************************************************/
  180.  
  181. #if !defined(__cplusplus) || defined(CINTERFACE)
  182.  
  183. #define IDirectPlayLobby_QueryInterface(p,a,b)              (p)->lpVtbl->QueryInterface(p,a,b)
  184. #define IDirectPlayLobby_AddRef(p)                          (p)->lpVtbl->AddRef(p)
  185. #define IDirectPlayLobby_Release(p)                         (p)->lpVtbl->Release(p)
  186. #define IDirectPlayLobby_Connect(p,a,b,c)                   (p)->lpVtbl->Connect(p,a,b,c)
  187. #define IDirectPlayLobby_CreateAddress(p,a,b,c,d,e,f)       (p)->lpVtbl->CreateAddress(p,a,b,c,d,e,f)
  188. #define IDirectPlayLobby_EnumAddress(p,a,b,c,d)             (p)->lpVtbl->EnumAddress(p,a,b,c,d)
  189. #define IDirectPlayLobby_EnumAddressTypes(p,a,b,c,d)        (p)->lpVtbl->EnumAddressTypes(p,a,b,c,d)
  190. #define IDirectPlayLobby_EnumLocalApplications(p,a,b,c)     (p)->lpVtbl->EnumLocalApplications(p,a,b,c)
  191. #define IDirectPlayLobby_GetConnectionSettings(p,a,b,c)     (p)->lpVtbl->GetConnectionSettings(p,a,b,c)
  192. #define IDirectPlayLobby_ReceiveLobbyMessage(p,a,b,c,d,e)   (p)->lpVtbl->ReceiveLobbyMessage(p,a,b,c,d,e)
  193. #define IDirectPlayLobby_RunApplication(p,a,b,c,d)          (p)->lpVtbl->RunApplication(p,a,b,c,d)
  194. #define IDirectPlayLobby_SendLobbyMessage(p,a,b,c,d)        (p)->lpVtbl->SendLobbyMessage(p,a,b,c,d)
  195. #define IDirectPlayLobby_SetConnectionSettings(p,a,b,c)         (p)->lpVtbl->SetConnectionSettings(p,a,b,c)
  196. #define IDirectPlayLobby_SetLobbyMessageEvent(p,a,b,c)      (p)->lpVtbl->SetLobbyMessageEvent(p,a,b,c)
  197.  
  198. #else /* C++ */
  199.  
  200. #define IDirectPlayLobby_QueryInterface(p,a,b)              (p)->QueryInterface(a,b)
  201. #define IDirectPlayLobby_AddRef(p)                          (p)->AddRef()
  202. #define IDirectPlayLobby_Release(p)                         (p)->Release()
  203. #define IDirectPlayLobby_Connect(p,a,b,c)                   (p)->Connect(a,b,c)
  204. #define IDirectPlayLobby_CreateAddress(p,a,b,c,d,e,f)       (p)->CreateAddress(a,b,c,d,e,f)
  205. #define IDirectPlayLobby_EnumAddress(p,a,b,c,d)             (p)->EnumAddress(a,b,c,d)
  206. #define IDirectPlayLobby_EnumAddressTypes(p,a,b,c,d)        (p)->EnumAddressTypes(a,b,c,d)
  207. #define IDirectPlayLobby_EnumLocalApplications(p,a,b,c)     (p)->EnumLocalApplications(a,b,c)
  208. #define IDirectPlayLobby_GetConnectionSettings(p,a,b,c)     (p)->GetConnectionSettings(a,b,c)
  209. #define IDirectPlayLobby_ReceiveLobbyMessage(p,a,b,c,d,e)   (p)->ReceiveLobbyMessage(a,b,c,d,e)
  210. #define IDirectPlayLobby_RunApplication(p,a,b,c,d)          (p)->RunApplication(a,b,c,d)
  211. #define IDirectPlayLobby_SendLobbyMessage(p,a,b,c,d)        (p)->SendLobbyMessage(a,b,c,d)
  212. #define IDirectPlayLobby_SetConnectionSettings(p,a,b,c)         (p)->SetConnectionSettings(a,b,c)
  213. #define IDirectPlayLobby_SetLobbyMessageEvent(p,a,b,c)      (p)->SetLobbyMessageEvent(a,b,c)
  214.  
  215. #endif
  216.  
  217. /****************************************************************************
  218.  *
  219.  * DirectPlayLobby Flags
  220.  *
  221.  ****************************************************************************/
  222.  
  223. /*
  224.  *      This flag is a message flag used by GetApplicationData.  It can be
  225.  *      returned in the dwMessageFlags parameter to indicate a message from
  226.  *      the system.
  227.  */
  228. #define DPLAD_SYSTEM                    0x00000001
  229.  
  230.  
  231. /****************************************************************************
  232.  *
  233.  * DirectPlayLobby system messages and message data structures
  234.  *
  235.  * All system message have a dwMessageFlags value of DPLAD_SYSTEM returned
  236.  * from a call to GetApplicationData.  
  237.  *
  238.  ****************************************************************************/
  239.  
  240. /*
  241.  * DPLMSG_GENERIC
  242.  * Generic message structure used to identify the message type.
  243.  */
  244. typedef struct DPLMSG_GENERIC
  245. {
  246.     DWORD       dwType;         // Message type
  247. } DPLMSG_GENERIC, FAR *LPDPLMSG_GENERIC;
  248.  
  249.  
  250. /******************************************
  251.  *
  252.  *      Sytem message dwType values
  253.  *
  254.  *****************************************/
  255.  
  256. /*
  257.  *  The application has read the connection settings.
  258.  *  It is now O.K. for the lobby client to release
  259.  *  its IDirectPlayLobby interface.
  260.  */
  261. #define DPLSYS_CONNECTIONSETTINGSREAD   0x00000001
  262.  
  263. /*
  264.  *  The application's call to DirectPlayConnect failed
  265.  */
  266. #define DPLSYS_DPLAYCONNECTFAILED       0x00000002
  267.  
  268. /*
  269.  *  The application has created a DirectPlay session.
  270.  */
  271. #define DPLSYS_DPLAYCONNECTSUCCEEDED    0x00000003
  272.  
  273. /*
  274.  *  The application has terminated.
  275.  */
  276. #define DPLSYS_APPTERMINATED            0x00000004
  277.  
  278.  
  279. /****************************************************************************
  280.  *
  281.  * DirectPlay Address ID's
  282.  *
  283.  ****************************************************************************/
  284.  
  285. /* DirectPlay Address
  286.  *
  287.  * A DirectPlay address consists of multiple chunks of data, each tagged
  288.  * with a GUID signifying the type of data in the chunk. The chunk also
  289.  * has a length so that unknown chunk types can be skipped.
  290.  *
  291.  * The EnumAddress() function is used to parse these address data chunks.
  292.  * The address data is passed to the SPInit method in the lpAddress field
  293.  * and the size is passed in the dwAddressSize field. These parameters are
  294.  * then passed to EnumAddress() to enumerate the tags.
  295.  */
  296.  
  297. /*
  298.  * DPADDRESS
  299.  *
  300.  * Header for block of address data elements
  301.  */
  302. typedef struct _DPADDRESS
  303. {
  304.     GUID                guidDataType;
  305.     DWORD               dwDataSize;
  306. } DPADDRESS;
  307.  
  308. typedef DPADDRESS FAR* LPDPADDRESS;
  309.  
  310.  /*
  311.  * DPAID_ServiceProvider
  312.  *
  313.  * Chunk is a GUID describing the service provider that created the chunk.
  314.  * All addresses must contain this chunk.
  315.  */
  316.  
  317. // {07D916C0-E0AF-11cf-9C4E-00A0C905425E}
  318. DEFINE_GUID(DPAID_ServiceProvider, 
  319. 0x7d916c0, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
  320.  
  321. /*
  322.  * DPAID_Phone
  323.  *
  324.  * Chunk is a string containing a phone number (i.e. "1-800-555-1212")
  325.  */
  326.  
  327. // {78EC89A0-E0AF-11cf-9C4E-00A0C905425E}
  328. DEFINE_GUID(DPAID_Phone, 
  329. 0x78ec89a0, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
  330.  
  331. /*
  332.  * DPAID_Inet
  333.  *
  334.  * Chunk is a string containing a TCP/IP host name or an IP address
  335.  *(i.e. "dplay.microsoft.com" or "137.55.100.173")
  336.  */
  337.  
  338. // {C4A54DA0-E0AF-11cf-9C4E-00A0C905425E}
  339. DEFINE_GUID(DPAID_INet, 
  340. 0xc4a54da0, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
  341.  
  342. /*
  343.  * DPCOMPORTADDRESS
  344.  *
  345.  * Used to specify com port settings. The constants that define baud rate,
  346.  * stop bits and parity are defined in WINBASE.H. The constants for flow
  347.  * control are given below.
  348.  */
  349.  
  350. #define DPCPA_NOFLOW        0           // no flow control
  351. #define DPCPA_XONXOFFFLOW   1           // software flow control
  352. #define DPCPA_RTSFLOW       2           // hardware flow control with RTS
  353. #define DPCPA_DTRFLOW       3           // hardware flow control with DTR
  354. #define DPCPA_RTSDTRFLOW    4           // hardware flow control with RTS and DTR
  355.  
  356. typedef struct _DPCOMPORTADDRESS
  357. {
  358.     DWORD   dwComPort;                  // COM port to use (1-4)
  359.     DWORD   dwBaudRate;                 // baud rate (100-256k)
  360.     DWORD   dwStopBits;                 // no. stop bits (1-2)
  361.     DWORD   dwParity;                   // parity (none, odd, even, mark)
  362.     DWORD   dwFlowControl;              // flow control (none, xon/xoff, rts, dtr)
  363. } DPCOMPORTADDRESS;
  364.  
  365. typedef DPCOMPORTADDRESS FAR* LPDPCOMPORTADDRESS;
  366.  
  367. /*
  368.  * DPAID_ComPort
  369.  *
  370.  * Chunk contains a DPCOMPORTADDRESS structure defining the serial port.
  371.  */
  372.  
  373. // {F2F0CE00-E0AF-11cf-9C4E-00A0C905425E}
  374. DEFINE_GUID(DPAID_ComPort, 
  375. 0xf2f0ce00, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
  376.  
  377. #ifdef __cplusplus
  378. };
  379. #endif /* __cplusplus */
  380.  
  381. #endif /* __DPLOBBY_INCLUDED__ */
  382.